package com.ruoyi.system.api.fallback;


import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.system.api.client.NewsClient;
import com.ruoyi.system.api.domain.News;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;

import static jdk.nashorn.internal.runtime.regexp.joni.Config.log;

@Component
public class NewsClientFallbackFactory implements FallbackFactory<NewsClient> {
    @Override
    public NewsClient create(Throwable cause) {
        return new NewsClient() {
            @Override
            public AjaxResult add(News news) {
                return AjaxResult.error("远程调用NewsClient#add方法出现异常");
            }

            @Override
            public AjaxResult edit(News news) {

                return AjaxResult.error("远程调用NewsClient#edit方法出现异常");
            }

            @Override
            public AjaxResult remove(Long[] newsIds) {
                 return AjaxResult.error("远程调用NewsClient#remove方法出现异常");
            }
        };
    }
}